Copyright: TrayIcon OCX Help, Copyright © 1996, Nikhil Kothari


About TrayIcon OCX

  TrayIcon OCX

TrayIcon is a 32 bit OCX for Windows 95.  It provides an easy way for OLE container applications such as Microsoft Visual BasicTM and Microsoft AccessTM (and several other development tools) to place their own icons in the tray area of the Windows 95 taskbar (as shown).  It allows the application to receive messages in order to show custom menus.

Remeber to read the License Agreement and Disclaimer before continuing to use the OCX in your applications.

TrayIcon OCX is shareware. Continued use of this OCX beyond 30 days requires Registration.

TrayIcon OCX is Copyright © 1996, Nikhil Kothari.


Files

The following is a list of files that are distributed as part of the TrayIcon OCX

•	TrayIcon.ocx	\windows\system

•	TrayIcon.lic	\windows\system

•	TrayIcon.hlp	\windows\system

•	TrayIcon.cnt	\windows\system

•	Sample\TrayIcon.exe

•	Sample\TrayIcon.vbp

•	Sample\frmTrayIcon.frm

•	Sample\frmTrayIcon.frx

Files not distributed are (these are usually part of the development system)

•	regsvr32.exe

•	mfc40.dll

•	msvcrt40.dll

•	olepro32.dll

Before using the ocx you must register it with the command

regsvr32 c:\windows\system\trayicon.ocx

There is also a topic describing the files that need to be distributed.


Icon Property

Properties	Methods	Events

This property lets you set the icon that is to be displayed in the tray area.

You need to use the ‘ShowIcon’ method to display your icon, or the ‘UpdateIcon’ method if you change it at runtime.

Example

Dim Success as Boolean

.

.

TrayIcon1.Icon = LoadPicture(icofilename)

Success = TrayIcon1.UpdateIcon

.


 ToolTip Property

Properties	Methods	Events

This property determines the tooltip that Windows displays when the cursor is placed over the icon.  Windows API limits this property to be a maximum of 63 characters long.

As with the icon property, you need to use the ‘UpdateIcon’ method if you change it at runtime.

Example

Dim Success as Boolean

.

.

TrayIcon1.ToolTip = “TrayIcon OCX Sample”

Success = TrayIcon1.UpdateIcon

.


Visible Property

Properties	Methods	Events

This property lets the application check if its icon is visible or not.  The property is read-only and is available only during runtime.

Example

Dim Visible as Boolean

.

.

Visible = TrayIcon1.Visible

.


AutoUpdate Property

Properties	Methods	Events

This property causes the ocx to update the icon in the tray area of the taskbar by calling the UpdateIcon method, whenever either the icon property or the tooltip property change.  The default value is ‘false’ so as to allow greater control over changes in the icon display.

Example

Dim AutoUpdate as Boolean

.

.

TrayIcon1.AutoUpdate = AutoUpdate

.


MouseMoveOverEvents Property

MouseOverEvents Property

Properties	Methods	Events

This property causes the ocx to fire the MouseOver event when the cursor moves the icon in the tray.  The default value is ‘false’ so that potential overflow of events can be avoided.

Example

Dim GetMouseMoveMsg as Boolean

.

.

TrayIcon1.AutoUpdate = GetMouseMoveMsg

.


Events

Properties	Methods	Events

These events occur when either the user clicks the icon in the taskbar tray or places the cursor over it, and let you take appropriate action, such as displaying a context menu etc.

The general format for all events is

<event name>([index as Integer], x as Integer, y as Integer)

There are currently five events that may occur.

LeftClick	when the user clicks the left mouse button on the icon

LeftDblClick	when the user double clicks the left mouse button on the icon

RightClick	when the user clicks the right mouse button on the icon

RightDblClick	when the user double clicks the right mouse button on the icon

MouseMoveOver	when the user moves the mouse over the icon

The parameters x and y to the event let your application know the mouse position (in terms of screen coordinates).  The optional parameter Index lets the application know which TrayIcon control of a control array caused the event.


ShowIcon Method

Properties	Methods	Events

This method causes the OCX to display the selected icon along with the selected tooltip in the tray area of the taskbar.  It returns ‘true’ if the operation was successful and ‘false’ otherwise.  If the icon is already visible, it return ‘false’.

Example

Dim Success as Boolean

.

.

Success = TrayIcon1.ShowIcon

.


HideIcon Method

Properties	Methods	Events

This method causes the OCX to remove the icon from the tray area of the taskbar.  It returns ‘true’ if it was successful and ‘false’ otherwise.  If the icon is currently not being displayed, the method returns ‘false’.

Example

Dim Success as Boolean

.

.

if TrayIcon1.ShowIcon then

Success = TrayIcon1.HideIcon

End If

.


UpdateIcon Method

Properties	Methods	Events

This method is used to change the icon or tooltip that is being displayed or its tooltip.  It returns ‘true’ id the modification was successful, ‘false’ otherwise.  If the icon is currently not being displayed, the method returns ‘false’, and does not display the icon.

Example

Dim Success as Boolean

.

.

if TrayIcon1.ShowIcon then

TrayIcon1.ToolTip = “new tooltip”

Success = TrayIcon1.UpdateIcon

End If

.


License Agreement

IMPORTANT: READ CAREFULLY:

This License Agreement is a legal agreement between you (either an individual or a single entity) and Nikhil Kothari, on the use of TrayIcon OCX, and associated help materials, samples and all accompanying material. By installing, copying, or otherwise using this software product, you agree to be bound by the terms of this License Agreement. If you do not agree to its terms,  promptly delete all copies of the software and all accompanying material.

SOFTWARE PRODUCT LICENSE

The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties.

1. GRANT OF LICENSE. This license grants you the following rights:

Software: You may install and use one copy of the SOFTWARE PRODUCT on a single computer.

Storage/Network Use: You may also store or install a copy of the SOFTWARE PRODUCT on a storage device, such as a network server, used only to install or run the SOFTWARE PRODUCT on your other computers over an internal network; however, you must acquire and dedicate a license for each separate computer on which the SOFTWARE PRODUCT is installed or run from the storage device. A license for      the SOFTWARE PRODUCT may not be shared or used concurrently on different computers. You may not loan, rent, lease or otherwise transfer the software using any medium to another user.  The OLE Custom control(including all necessary runtime DLLs) may be distributed for runtime use ROYALTY-FREE.

2. DISCLAIMER OF WARRANTY. This Software is provided on an "AS IS" basis, without warranty of any kind, including, without limitation, the warranties of merchantability, fitness for a particular purpose and non-infringement. The use of this software and its registration does not guarantee any kind of support from Nikhil Kothari.  The entire risk as to the quality and performance of the Software is borne by you. Should the Software prove defective in any way, you and not Nikhil Kothari shall assume the entire cost of any service and repair.

4. LIMITATION OF LIABILITY. Under no circumstances and under no legal theory, tort, contract, or otherwise, shall Nikhil Kothari be liable to you or any other person for any indirect, special, incidental, or consequential damages of any character including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses that results from use of the software or any of the accompanying material.

5. MISCELLANEOUS. This Agreement represents the complete agreement concerning this license between the parties and supersedes all prior agreements and representations between them. It may be amended only by a writing executed by both parties. If any provision of this Agreement is held to be unenforceable for any reason, such provision shall be reformed only to the extent necessary to make it enforceable.

6.TERMINATION. This license will terminate automatically if you fail to comply with the limitations described above. On termination, you must destroy all copies of the Software and accompanying material.


Feedback

My email address is nkothari@ics.uci.edu

Report all bugs and feedback to the above email address.  This will help me improve the OCX.


Distributing the TrayIcon Control

When distributing the OLE control the following support files must also be distributed:

The list includes the file names and the copy locations.

MFC40.DLL \Windows\System

MSVCRT40.DLL \Windows\System

OLEPRO32.DLL \Windows\System

REGSVR32.EXE \Windows\System

TRAYICON.OCX \Windows\System

Do not distribute the following files (these are meant only for the development environment)

(These are to be placed in the same directory as the ocx)

TRAYICON.HLP

TRAYICON.LIC

Once the TRAYICON.OCX is copied to the specified directory it must be registered in order to work correctly. This can be done using the REGSVR32.EXE utility. Simply call run the REGSVR32.EXE from the command line with TRAYICON.OCX as the parameter as shown below.

C:\Windows\System\REGSVR32 TRAYICON.OCX


Registering the TrayIcon Conrol

Registering the TrayIcon Control

TrayIcon OCX is shareware and can be registered for US $25.00.  When you register, the OCX’s ‘About Dialog Box’ will not appear everytime you use it.  It will also guarantee that you will continue to receive news as new features and improvements are made, and you will receive major updates free of charge.  As a registered user you can purchase all the source code (commented) for US $ 100.00.

To register send the following information to nkothari@ics.uci.edu via email:

Name	_____________________________

Company	_____________________________

Address	_____________________________

_____________________________

_____________________________

Phone	_____________________________

Email address	_____________________________

How you obtained this OCX

__________________________________________

Purchase the source code	Yes	No

On sending this, you will receive information as to where you can mail your check to, and once I receive your check, the registered version of the OCX will be sent to you through email.  If you cannot receive the software through email, add $5.00 to your check, and I will send it through mail on disk.